package com.example.goodpet.activity.adapter;

import android.view.View;

import androidx.annotation.NonNull;
import androidx.fragment.app.Fragment;
import androidx.fragment.app.FragmentActivity;
import androidx.fragment.app.FragmentManager;
import androidx.fragment.app.FragmentStatePagerAdapter;
import androidx.lifecycle.Lifecycle;
import androidx.recyclerview.widget.RecyclerView;
import androidx.viewpager2.adapter.FragmentStateAdapter;

import com.example.goodpet.R;
import com.example.goodpet.bean.UserPetInfo;

import java.util.ArrayList;
import java.util.List;

public class MyFragmentVPAdapter extends FragmentStateAdapter {
    private List<Fragment> lists;

    public MyFragmentVPAdapter(@NonNull FragmentActivity fragmentActivity, List<Fragment> lists) {
        super(fragmentActivity);
        this.lists=lists;
    }

    public MyFragmentVPAdapter(@NonNull FragmentManager fragmentManager, @NonNull Lifecycle lifecycle, List<Fragment> lists) {
        super(fragmentManager, lifecycle);
        this.lists = lists;
    }

    @NonNull
    @Override
    public Fragment createFragment(int position) {
        return lists.get(position);
    }

    @Override
    public int getItemCount() {
        return lists.size();
    }

}
